'use strict'

class  cart{
  
  constructor () {

  }
  //得到购物车列表
  async get (c) {
    let userid= c.param.id
    // console.log(c.param)
    let wuser = c.service.model.cart
    let ulist = await wuser.get(userid)
    c.send(ulist)
  }

  //添加购物车
  async post (c) {
    let data=JSON.parse(c.body)
    let wuser = c.service.model.cart
    await wuser.insert(data)
  }

  //删除购物车
  async delete(c){
    let cartid=c.param.id
    let wuser = c.service.model.cart
    await wuser.delete(cartid)
  }

}

module.exports = cart